/*
 * SiFiSy - A File System Simulator
 * Copyright (C) 2010  SevenSoft
 *
 * This file is part of SiFiSy.
 *
 * SiFiSy is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * SiFiSy is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with SiFiSy.  If not, see <http://www.gnu.org/licenses/>.
 */

package sifisy.newgui;

import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import javax.swing.border.TitledBorder;
import sifisy.core.Model;

/**
 * @author Giuseppe Biolo
 * @version %I%, %G%
 * @createData 04/05/2010
 */
public class AlertWidget extends JDialog {
    private JButton ok;
    private JButton back;
    private JTextArea message;

    private void initComponents() {
        ok = new JButton("OK");
        back = new JButton("Indietro");
        message = new JTextArea("Proseguendo verranno bloccate tutte le configurazioni della partizione e del disco, e si perdera' l'inserimento del file precedente");
        message.setEditable(false);
        message.setLineWrap(true);

        back.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                (AlertWidget.this).dispose();
            }
        });
    }

    public AlertWidget() {
        super();
        this.setTitle("SiFiSy");

        initComponents();

        JPanel messagePanel = new JPanel(new GridLayout(1,1));
        messagePanel.setBorder(new TitledBorder("Attenzione"));
        messagePanel.add(message);

        JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
        buttonsPanel.add(ok);
        buttonsPanel.add(back);

        setLayout(new BorderLayout());
        add(messagePanel,BorderLayout.CENTER);
        add(buttonsPanel,BorderLayout.SOUTH);

        setSize(300,150);
    }

    public static void main(String[] args) {
        (new AlertWidget()).setVisible(true);
    }
}